package com.qianji.utils;

import lombok.Data;

@Data
public class Result<T>{
    private int code;
    private Integer status;

    private String message;

    private T data;

    private Long count;

    public Result(Integer status , String message , T data){
        this.status = status;
        this.message = message;
        this.data = data;

    }
    public Result(){
    }

    public Result(Integer status, String message){
        this.status = status;
        this.message = message;
    }
    public Result(T data){
        this.code = 0 ;
        this.status = 200;
        this.message = "成功";
        this.data = data;
    }

    public Result(String msg, int code) {
        this.message = msg;
        this.code = code;
    }

    public Result(T data,Long count) {
        this.data = data;
        this.count = count;
    }

    public static Result success(){

        return  new Result();
    }

    public static Result success(String msg,int code){
        return  new Result(msg,code);
    }

    public static Result success(Object data){

        return  new Result(data);
    }

    public static Result success(Object data,Long count){

        return  new Result(data,count);
    }

    public static Result failed(String msg, int code) {
        return new Result(msg,code);
    }
}
